package com.twu.biblioteca.db;

import com.twu.biblioteca.model.Item;

import java.util.ArrayList;
import java.util.List;

public abstract class Store {
    List<Item> items;

    public Store() {
        this.items = new ArrayList<Item>();
    }

    public void printList(){
        printHeader();
        for(Item item : items){
            if(item.isAvailable())
                item.printDetails();
        }
    }

    abstract void printHeader();

    public Item findById(String id) {
        for(Item item : items){
            if(id.equals(item.getId())){
                return item;
            }
        }
        return null;
    }
}
